<template>
  <div id="showAlert">
    <div>showAlert 内容</div>
    <button class="close" @click="close">关闭</button>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {};
  },
  mounted() {
    console.log("value:", this.value);
  },
  methods: {
    close() {
      this.$emit("input", false); //传值给父组件, 让父组件监听到这个变化
    }
  }
};
</script>

<style scoped>
.close {
  background: red;
  color: white;
}
</style>
